import math
class Solution(object):
    def smallestDivisor(self, nums, threshold):
        left = 1
        right = max(nums)
        def cal(s):
            return sum([math.ceil(num / s) for num in nums])
        while left < right:
            mid = (left + right) // 2
            if cal(mid) <= threshold:
                right = mid
            else:
                left = mid + 1
        return left